package com.qf.mrmd.controller;

import com.qf.mrmd.entity.Subject;
import com.qf.mrmd.result.ResponseData;
import com.qf.mrmd.service.SubjectService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * (Subject)表控制层
 *
 * @author makejava
 * @since 2021-07-14 14:44:30
 */
@RestController
@RequestMapping("subjects")
public class SubjectController {

    @Autowired
    private SubjectService subjectService;

    @ApiOperation(value = "获取推荐美容项目数据",notes = "通过标题获取美容项目列表")
    @ApiImplicitParam(name = "title",value = "美容项目类型",dataType = "string")
    @GetMapping("/{title}")
    public ResponseData subjectInfo(@PathVariable String title){
        return subjectService.queryByTitle(title);
    }

    @ApiOperation(value = "获取美容项目详情",notes = "通过美容项目id获取项目详情")
    @ApiImplicitParam(name = "id",value = "美容项目id",dataType = "integer")
    @GetMapping("/one/{id}")
    public ResponseData subjectDetail(@PathVariable Integer id){
        return subjectService.queryById(id);
    }

    @ApiOperation(value = "获取项目名称",notes = "通过商家id获取项目名称")
    @ApiImplicitParam(name = "sid",value = "商家id",dataType = "integer")
    @GetMapping("/shop/{sid}")
    public ResponseData querySubjectBysId(@PathVariable Integer sid){
        return subjectService.queryBysId(sid);
    }

    @ApiOperation(value = "获取项目名称",notes = "通过商家id获取项目名称")
    @ApiImplicitParam(name = "shopname",value = "商家名称")
    @GetMapping("/shop/name/{shopname}")
    public ResponseData querySubjectByshopName(@PathVariable String shopname){
        return subjectService.querySubjectByshopName(shopname);
    }

}
